package com.itheima.exer.exercise.ex0925;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

public class PlusDemo2 {
    public static void main(String[] args) {
        LocalDateTime ldt = LocalDateTime.of(2012,12,12,12,12,11);
        LocalDateTime time = ldt.plusYears(8).plusMonths(9).plusDays(3);
        DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy年MM月dd日 HH时mm分ss秒");
        String format = ldt.format(dateTimeFormatter);
        String format1 = time.format(dateTimeFormatter);
        System.out.println("从"+format+"增加8年9个月3天后是"+format1);
        LocalDateTime time1 = time.minusYears(3).minusMonths(19).minusDays(9);
        String format2 = time1.format(dateTimeFormatter);
        System.out.println("从"+format1+"减3年19个月9天后是"+format2);
    }
}
